package com.box.app.arithmetic

@Suppress("EnumEntryName")
enum class Curve : Symbol {
    left,
    right;

    override fun toDescribe(isTight: Boolean) = when (this) {
        left -> "("
        right -> ")"
    }

    override fun toString() = toDescribe(true)

    companion object {
        internal fun wrap(arithmetic: Arithmetic) = left + arithmetic + right

        private fun maybeOf(s: String) = values().singleOrNull { it.toString() == s }

        internal fun of(s: String) = checkNotNull(maybeOf(s))
    }
}
